package main

import "fmt"

// 声明一种行的数据类型 myint，是int的一个别名
type myint int

// 定义一个结构体
type MyTeacher struct {
	name string
	age  int
}

func main() {
	var value1 myint = 1
	fmt.Println(value1)
	fmt.Printf("%T\n", value1)

	var malaoshi MyTeacher = MyTeacher{
		"laoma", 10,
	}

	fmt.Println(malaoshi)

	var zenglaoshi MyTeacher
	zenglaoshi.name = "fengge"
	zenglaoshi.age = 100
	fmt.Println(zenglaoshi)
	fmt.Printf("%v \t %T\n", zenglaoshi, zenglaoshi)

	fmt.Println("================")
	changeTeacherActually(&zenglaoshi)
	fmt.Println(zenglaoshi)
}

func changeTeacher(teacher MyTeacher) {
	// 传递一个副本
	teacher.name = "wuming"
}

func changeTeacherActually(teacher *MyTeacher) {
	// 传递地址
	teacher.name = "wuming"
}
